package com.train.classeval.service.impl;

import com.train.classeval.entity.EvalActivity;
import com.train.classeval.entity.OV.ShowActiveOV;
import com.train.classeval.entity.OV.ShowProActiveOV;
import com.train.classeval.mapper.EvalActivityMapper;
import com.train.classeval.service.IEvalActivityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xs
 * @since 2021-10-23
 */
@Service
@Transactional
public class EvalActivityServiceImpl extends ServiceImpl<EvalActivityMapper, EvalActivity> implements IEvalActivityService {

    @Autowired
    private EvalActivityMapper evalActivityMapper;

    @Override
    public List<ShowProActiveOV> showProAct(Integer pid) {
        final List<ShowProActiveOV> showProActiveOVS = evalActivityMapper.showProAct(pid);
        return showProActiveOVS;
    }

    @Override
    public Integer sumPES(Integer aid) {
        return evalActivityMapper.sumPES(aid);
    }

    @Override
    public List<ShowActiveOV> findAllAct() {
        final List<ShowActiveOV> allAct = evalActivityMapper.findAllAct();
        return allAct;
    }

    @Override
    public Integer updateScore(Integer eid, Integer score) {
        final Integer integer = evalActivityMapper.updateScore(eid, score);
        return integer;
    }

    @Override
    public ShowActiveOV findOneActive(Integer aid) {
        ShowActiveOV oneActive = evalActivityMapper.findOneActive(aid);
        return oneActive;
    }
}
